<template>
	<view>
		<view class="con">
			<view v-if="list.length>0">
				<view class="list" :style="item.flag=='OUT'?'background: #ffffff;':'background: #ffffff;'"
					v-for="(item,index) in list" :key='index'>
					<view class="item1" :class="item.flag=='OUT'?'item12':'item1'"></view>
					<view class="item2">
						<view class="con1">{{ item.name }} <text v-if="item.title">({{ item.title }})</text></view>
						<view class="con2">{{ item.createtime }}</view>
					</view>
					<view class="item3" :class="item.flag=='OUT'?'color2':'color1'">
						{{item.flag=='OUT'?'-':'+'}}{{ item.change }}<text
							style="font-size:26rpx;margin-left:10rpx;"></text></view>
				</view>
			</view>
			<view class="none" v-else>
				<view class="none-view">
					<image src="../../../static/image/none.png" class="none-image"></image>
					<view class="none-name">
						暂无相关数据~
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	var than;
	export default {
		data() {
			return {
				list: [],
				page: 1
			}
		},
		onLoad(option) {
			than = this;
			than.getList()
		},
		onReachBottom() {
			than.page++;
			than.getList()
		},
		methods: {
			getList() {
				than.post("api/credit/creditList", {
					page: than.page
				}, function(data) {
					for (let i in data.list) {
						var d = data.list[i]
						switch (d.reason) {
							case 'goods_business':
								d.name = "抢拍蜂巢"
								break;
							case 'invitation_successful':
								d.name = "邀请好友"
								break;
							case 'not_upload_voucher_for_goods':
								d.name = "蜂巢未上传凭证"
								break;
							case 'not_upload_voucher_for_kmb':
								d.name = "蜜贝未上传凭证"
								break;
							case 'real_name_authentication':
								d.name = "实名认证"
								break;
							case 'receiving_address':
								d.name = "上传地址"
								break;
							case 'second_not_upload_voucher_for_goods':
								d.name = "蜂巢未重新上传"
								break;
							case 'second_not_upload_voucher_for_kmb':
								d.name = "蜜贝未重新上传"
								break;
							case 'seller_have_eminder':
								d.name = "卖家被催单"
								break;
							case 'seller_not_confirm_for_goods':
								d.name = "蜂巢自动确认"
								break;
							case 'seller_not_confirm_for_kmb':
								d.name = "蜜贝自动确认"
								break;
							case 'share_goods':
								d.name = "分享蜂巢"
								break;
							case 'trade_goods_buyer_reason':
								d.name = "申述责任"
								break;
							case 'trade_goods_saler_reason':
								d.name = "申述责任"
								break;
							case 'trade_kmb_buyer_reason':
								d.name = "申述责任"
								break;
							case 'trade_kmb_saler_reason':
								d.name = "申述责任"
								break;
							case 'upload_collection_pictures':
								d.name = "完善收款码"
								break;
							case 'upload_headimg_name':
								d.name = "完善基础资料"
								break;
							case 'buy_credit_score_kmb':
								d.name = "兑换信用分"
								break;
							case 'buy_credit_score_gdb':
								d.name = "兑换信用分"
								break;
							case 'breach_agreement_frozen':
								d.name = "违约冻结"
								break;
							case 'auto_harvest_refuse':
								d.name = "自动收货驳回"
								break;
							case 'appointment_but_not_buy':
								d.name = "预约未抢拍"
								break;
							case 'MANUAL_CHANGE_ADMIN':
								d.name = "信用返还"
								break;
							case 'invite_friend':
								d.name = "邀请好友"
								break;
							default:
								d.name = "未知"
								break;
						}
					}
					if (than.page == 1) {
						than.list = data.list;
					} else {
						than.list = than.list.concat(data.list)
					}
				})
			}
		}
	}
</script>

<style lang="less">
	page {
		background: #FAFAFA;
	}

	.con {
		padding: 36rpx;

		.list:first-child {
			margin-top: 0rpx;
		}

		.list {
			padding: 30rpx;
			border-radius: 20rpx;
			display: flex;
			align-items: center;
			margin-top: 20rpx;

			.item1 {
				width: 20rpx;
				height: 20rpx;
				background: #004FFF;
				border: 3rpx solid #FFFFFF;
				box-shadow: 0px 4px 9px 0px rgba(135, 131, 127, 0.3);
				border-radius: 50%;
			}

			.item12 {
				width: 20rpx;
				height: 20rpx;
				background: #A7A7A7;
				border-radius: 50%;
			}

			.item2 {
				flex: 1;
				margin-left: 20rpx;

				.con1 {
					font-size: 28rpx;
					font-weight: bold;
					color: #333333;
				}

				.con2 {
					font-size: 24rpx;
					//font-weight: bold;
					color: #8B93A2;
					margin-top: 10rpx;
				}
			}

			.item3 {
				font-size: 40rpx;
				//font-style: italic;
				font-family: myFirstFont;
				font-weight: bold;

			}

			.color1 {
				color: #F46813;
			}

			.color2 {
				color: #333333;
			}
		}
	}
</style>
